<?php
class MySQL {
	public $link;
	public $result;
	public function __construct($host, $user, $pass){
		$this->link = $this->connect($host, $user, $pass);
		ini_set("max_execution_time","1800");
	}
	public function __destruct(){
		@mysql_close($link);
		// mysql_free_result($result);		
	}
	public function select_db($name){
		return mysql_select_db($name, $this->link);
	}
	public function query($query){
		// echo $query = "INSERT INTO Product VALUES ('621', 'Gummi-Anschlagleiste 2600mm', NULL, NULL, 2600, '50 ' ,0,0,0,0);";		
		$this->result = mysql_query($query, $this->link) or die("Szar" . mysql_error());
		// echo mysql_num_fields ( $this->link );
		return $this->result;
	}
	public function connect($host, $user, $pass){
		return mysql_connect($host, $user, $pass);
	}
	public function ConnectionTest(){
		if (!$this->link) {
		// die('Could not connect: ' . mysql_error());
		}
		echo 'Connected successfully';
	}
	public function AffectedRows() {
		return mysql_affected_rows($this->link);
	}
	public function FieldName($num)
	{
		return mysql_field_name($this->result, $num);
	}
	public function Error()
	{
		return mysql_error($this->link);
	}
}
?>